Skip to content

Conversation

ada4a
Copy link
Contributor

@ada4a ada4a commented Sep 29, 2025

I.e, instead of constructing a whole new LetStmt to replace the old one, suggest to only change the part of the LetStmt that we don't like. This makes the suggestion less likely to introduce spurious changes, but also makes the diagnostic much nicer imo.

Fixes #15771 by not adding a semicolon that the initial LetStmt didn't have
Fixes #15784 by using the init.span with the correct SyntaxContext

changelog: [let_unit_value]: don't add spurious semicolon
changelog: [let_unit_value]: don't mangle macro calls

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Sep 29, 2025
@rustbot
Copy link
Collaborator

rustbot commented Sep 29, 2025

r? @samueltardieu

rustbot has assigned @samueltardieu.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@github-actions
Copy link

Lintcheck changes for f6dd112

Lint Added Removed Changed
clippy::let_unit_value 0 0 3

This comment will be updated if you push new changes

Copy link
Member

@samueltardieu samueltardieu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lintcheck shows a failing situation because of a #[cfg] attribute but this is unrelated to this PR.

View changes since this review

@samueltardieu samueltardieu added this pull request to the merge queue Sep 29, 2025
Merged via the queue into rust-lang:master with commit 5ab16d1 Sep 29, 2025
11 of 13 checks passed
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Sep 29, 2025
@ada4a ada4a deleted the let_unit_value branch September 29, 2025 22:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

let_unit_value suggestion mangles macros Incorrect semi-colon placement in clippy::let_unit_value

3 participants